<form id="form" class="layui-form" action="{:url()}" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-inline">
            <input type="text" name="username" value="" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password" value="" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-inline">
            <input type="password" name="repassword" value="" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">管理员角色</label>
        <div class="layui-input-block">
            {volist name="roleList" id="vo"}
            <input type="checkbox" name="ids[]" value="{$vo['id']}" lay-skin="primary" title="{$vo['name']}">
            {/volist}
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn submitForm" formId="form">提交</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    $(function(){
        var currentLayerIndex = parent.ybLayer.getFrameIndex(window.name);

        $('.submitForm').click(function (evt) {
            formPost(evt, $(this), function (res) {
                ybLayer.msg(res.msg,{icon: 6});
                setTimeout(function () {
                    parent.ybLayer.close(currentLayerIndex);
                    parent.ybTable.reload('mytable');
                }, 1000);
            }, function (res) {
                ybLayer.msg(res.msg, {icon: 5});
            });
            return false;
        });
    })
</script>